Skip to content

test: Fix TODO by adding Pattern type to BSON codec test#1830

Open
HJC96 wants to merge 4812 commits intomongodb:mainfrom
HJC96:fix/test-pattern-codec
Open

test: Fix TODO by adding Pattern type to BSON codec test#1830
HJC96 wants to merge 4812 commits intomongodb:mainfrom
HJC96:fix/test-pattern-codec

Conversation

@HJC96
Copy link
Copy Markdown
Contributor

@HJC96 HJC96 commented Oct 20, 2025

Problem

The test had a commented-out Pattern test with TODO note:

// TODO: Pattern doesn't override equals method!

This prevented Pattern from being tested alongside other primitive BSON types.

Changes

  • Removed TODO comment
  • Added Pattern encode/decode test
  • Pattern objects are decoded as BsonRegularExpression, so comparison is done separately

vbabanin and others added 30 commits October 31, 2024 13:21
JAVA-5650
---------

Co-authored-by: Valentin Kovalenko <valentin.male.kovalenko@gmail.com>
Clean up unified tests via skipping API
* Add flaky annotation to flaky tests
JAVA-5505

Co-authored-by: Valentin Kovalenko <valentin.male.kovalenko@gmail.com>
* Clean up TestDef API, clarify naming

* Update driver-sync/src/test/functional/com/mongodb/client/unified/UnifiedTestModifications.java

Co-authored-by: Nabil Hachicha <nabil.hachicha@gmail.com>

* PR fixes

---------

Co-authored-by: Nabil Hachicha <nabil.hachicha@gmail.com>
* Helper methods and extensions to improve kotlin interop. (mongodb#1478)

Adds a new package `org.mongodb.mongodb-driver-kotlin-extensions`. Its both, kotlin driver and bson kotlin implementation agnostic. Can be used with any combination of `bson-kotlin`, `bson-kotlinx`, `mongodb-driver-kotlin-sync` and `mongodb-driver-kotlin-coroutine`.

Initial Filters extensions support, with both inflix and nested helpers eg:

```
import com.mongodb.kotlin.client.model.Filters.eq

// infix
Person::name.eq(person.name)

// nested
val bson = eq(Person::name, person.name)
```

Also adds path based support which works with vairous annotations on the data class: `@SerialName("_id")`, `@BsonId`, `@BsonProperty("_id")`:

```
(Restaurant::reviews / Review::score).path() == "reviews.rating"
```

JAVA-5308 JAVA-5484

* Gradle: Support custom header annotation

* Added since annotation to Filters.kt

JAVA-5308

* Adding Kotlin extensions methods for projection. (mongodb#1515)

* Adding Kotlin extensions methods for projection. Fixes JAVA-5603

---------

Co-authored-by: Ross Lawley <ross.lawley@gmail.com>

* Adding Kotlin extensions methods for updates   (mongodb#1529)

* Adding Kotlin extension function for Updates operations
JAVA-5601

* Grouping static checks under the same task (mongodb#1526)

* Grouping all static checks under the "check" task

JAVA-5633

* Add extension methods for Indexes (mongodb#1532)

JAVA-5604

* Adding extension methods for Sorts (mongodb#1533)

JAVA-5602

* Adding extensions for Aggregators and Accumulators (mongodb#1562)

* Adding extensions for Aggregators and Accumulators

---------

Co-authored-by: Ross Lawley <ross@mongodb.com>
Co-authored-by: Ross Lawley <ross.lawley@gmail.com>
…a to do that (mongodb#1578)

When `com.mongodb.client.unified.UnifiedTest` is used by `com.mongodb.workload.WorkloadExecutor` for running tests with Astrolabe, `TestDef` shouldn't be created.

JAVA-5716
Remove deprecated field from GridFS unified tests

Removes the use of deprecated fields -- md5, contentType, and aliases -- from the GridFS unified tests

JAVA-5709
Add index hint support for distinct command

Add index hint support for distinct command for java, kotlin, and scala, and sync CRUD unified spec tests

JAVA-5686
Allow updateOne and replaceOne to supply sort option

Adding sort option for updateOne and replaceOne commands, so if it matches more than one candidate document, the first one matched by sort order will be updated.

JAVA-5722
…ew (mongodb#1594)

JAVA-5738
---------

Co-authored-by: Valentin Kovalenko <valentin.male.kovalenko@gmail.com>
Introduce the Client Bulk Write API to support write operations across multiple collections and databases. This update allows mixed operations and cross-namespace bulk writes to be executed in a single batch: https://www.mongodb.com/docs/manual/reference/command/bulkWrite/.

JAVA-4586
---------

Co-authored-by: Valentin Kovalenko <valentin.kovalenko@gmail.com>
Co-authored-by: Viacheslav Babanin <slav.babanin@mongodb.com>
Co-authored-by: Jeff Yemin <jeff.yemin@mongodb.com>
rozza and others added 24 commits September 11, 2025 10:10
…mongodb#1803)

Test that previously expected a MongoCommandException no
longer does on the latest build.

JAVA-5960
Appears theres been a change when using mongocryptd and
an empty document is returned.

 Removed legacy Client Encryption test from the shell runner

JAVA-5959
Fixes NPE due to BSONIgnore fields introduced in mongodb#1610

JAVA-5971

---------

Co-authored-by: Ross Lawley <ross@mongodb.com>
Improves the ergonomics of the Updates helper and keeps `$set` helpers inline with `$setOnInsert`.

JAVA-5620
Eliminate unnecessary killCursors command when batchSize == limit
can overflow if using Integer.MAX_VALUE for both.

JAVA-5667
JAVA-5970
…ons (mongodb#1812)

Update SyncMongoClient to assert connections are released
Ensure errors thrown outside of the callback also release the resource in AsyncOperationHelper


JAVA-5972
Avoid appending duplicate metadata
Added new @internal annotation for non public / public apis

JAVA-5955

---------

Co-authored-by: Viacheslav Babanin <frest0512@gmail.com>
mongodb#1768)

JAVA-5044

---------

Co-authored-by: Viacheslav Babanin <slav.babanin@mongodb.com>
Co-authored-by: Maxim Katcharov <maxim.katcharov@mongodb.com>
…outContext. (mongodb#1777)

JAVA-5927

---------

Co-authored-by: Ross Lawley <ross@mongodb.com>
Co-authored-by: Ross Lawley <ross.lawley@gmail.com>
…odb#1811)

Bumps [driver-core/src/test/resources/specifications](https://github.com/mongodb/specifications) from `eb7f9a2` to `ace53b1`.
- [Release notes](https://github.com/mongodb/specifications/releases)
- [Commits](mongodb/specifications@eb7f9a2...ace53b1)

---
updated-dependencies:
- dependency-name: driver-core/src/test/resources/specifications
  dependency-version: ace53b165f2ab83e8385de15fbda9346befc0ea7
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
As the output of gradlew is piped to tee, the return value is lost.
This can be fixed by using pipefail which sets the return value of
a pipeline is the value of the last (rightmost) command to exit with
a non-zero status

JAVA-5983

---------

Co-authored-by: Nabil Hachicha <nabil.hachicha@gmail.com>
* Add support for awaitMinPoolSize in unified test runner.

JAVA-5957
Use secrets manager to initialize atlas connect variables.
Change namespace in atlas and add data (user is read only).

JAVA-5961

Co-authored-by: slav.babanin <slav.babanin@mongodb.com>
Add tracing support using Micrometer via the Observation API

JAVA-5733
---------

Co-authored-by: Viacheslav Babanin <slav.babanin@mongodb.com>
Co-authored-by: Ross Lawley <ross@mongodb.com>
…odb#1826)

The unified tests all expect to be run via tcp

JAVA-5733
@HJC96 HJC96 requested a review from a team as a code owner October 20, 2025 14:08
@HJC96 HJC96 requested review from vbabanin and removed request for a team October 20, 2025 14:08
@HJC96 HJC96 force-pushed the fix/test-pattern-codec branch from 404648b to fe59fbb Compare March 23, 2026 19:51
@strogiyotec strogiyotec requested a review from Copilot April 1, 2026 04:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR is described as fixing a TODO by adding a Pattern encode/decode test, but the diff includes a much broader set of changes that add new modules (Scala BSON wrapper, Kotlin codecs, Java record codec), introduce release automation, add Evergreen scripts, and remove legacy files.

Changes:

  • Adds new bson-scala, bson-kotlin, bson-kotlinx, and bson-record-codec code and tests, and wires them into the BOM.
  • Introduces GitHub release workflow scripts and Dependabot submodule updates.
  • Removes legacy repo artifacts (History.md, .travis.yml) and adds various build/evergreen scripts.

Reviewed changes

Copilot reviewed 143 out of 4010 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
bson/build.gradle.kts Adds module build configuration for bson.
bson-scala/src/test/scala/org/mongodb/scala/bson/collections/DocumentImplicitTypeConversion.scala Adds Scala tests for document implicit conversions.
bson-scala/src/test/scala/org/mongodb/scala/bson/codecs/Registry.scala Adds default Scala codec registry helper for tests.
bson-scala/src/test/scala/org/mongodb/scala/bson/codecs/MutableDocumentCodecSpec.scala Adds tests for mutable Document codec encode/decode and id handling.
bson-scala/src/test/scala/org/mongodb/scala/bson/codecs/IterableCodecSpec.scala Adds tests for Iterable codec encode/decode.
bson-scala/src/test/scala/org/mongodb/scala/bson/codecs/IterableCodecProviderSpec.scala Adds tests for Iterable codec provider behavior.
bson-scala/src/test/scala/org/mongodb/scala/bson/codecs/ImmutableDocumentCodecSpec.scala Adds tests for immutable Document codec encode/decode and id handling.
bson-scala/src/test/scala/org/mongodb/scala/bson/codecs/DocumentCodecProviderSpec.scala Adds tests for Document codec provider behavior.
bson-scala/src/test/scala/org/mongodb/scala/bson/BsonValueSpec.scala Adds Scala tests for BSON value companion constructors.
bson-scala/src/test/scala/org/mongodb/scala/bson/BsonTransformerSpec.scala Adds Scala tests for transformer conversions.
bson-scala/src/test/scala/org/mongodb/scala/bson/BaseSpec.scala Adds Scalatest base spec configuration.
bson-scala/src/main/scala/org/mongodb/scala/bson/package.scala Adds Scala BSON package aliases and helpers.
bson-scala/src/main/scala/org/mongodb/scala/bson/conversions/package.scala Adds Scala conversions package alias.
bson-scala/src/main/scala/org/mongodb/scala/bson/collection/package.scala Adds Scala collection package aliases.
bson-scala/src/main/scala/org/mongodb/scala/bson/codecs/package.scala Adds Scala codec aliases/factories.
bson-scala/src/main/scala/org/mongodb/scala/bson/codecs/macrocodecs/CaseClassProvider.scala Adds macro-based codec provider generation.
bson-scala/src/main/scala/org/mongodb/scala/bson/codecs/MutableDocumentCodec.scala Adds mutable Document codec implementation.
bson-scala/src/main/scala/org/mongodb/scala/bson/codecs/Macros.scala Adds public macros API for codecs.
bson-scala/src/main/scala/org/mongodb/scala/bson/codecs/IterableCodecProvider.scala Adds Iterable codec provider implementation.
bson-scala/src/main/scala/org/mongodb/scala/bson/codecs/IterableCodec.scala Adds Iterable codec implementation.
bson-scala/src/main/scala/org/mongodb/scala/bson/codecs/ImmutableDocumentCodec.scala Adds immutable Document codec implementation.
bson-scala/src/main/scala/org/mongodb/scala/bson/codecs/DocumentCodecProvider.scala Adds Document codec provider implementation.
bson-scala/src/main/scala/org/mongodb/scala/bson/annotations/BsonProperty.scala Adds Scala-side annotation shim.
bson-scala/src/main/scala/org/mongodb/scala/bson/annotations/BsonIgnore.scala Adds Scala-side annotation shim.
bson-scala/src/main/scala/org/mongodb/scala/bson/DefaultHelper.scala Adds Scala default-type helper.
bson-scala/src/main/scala/org/mongodb/scala/bson/BsonMagnets.scala Adds magnet pattern / implicit conversions for BSON values/elements.
bson-scala/src/main/scala/org/mongodb/scala/bson/BsonElement.scala Adds BSON element companion helper.
bson-scala/src/main/scala-2.13-/org/mongodb/scala/bson/collection/immutable/Document.scala Adds Scala 2.13- immutable Document implementation.
bson-scala/src/main/scala-2.13+/org/mongodb/scala/bson/collection/immutable/Document.scala Adds Scala 2.13+ immutable Document implementation.
bson-scala/build.gradle.kts Adds build configuration for Scala BSON module.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestSelfReferentialRecord.java Adds record-codec test sample record.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestSelfReferentialHolderRecord.java Adds record-codec test sample record.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithPojoAnnotations.java Adds record-codec test sample with POJO annotations.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithParameterizedRecord.java Adds record-codec test sample with parameterized record field.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithNullableField.java Adds record-codec test sample with nullable field.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithNestedParameterizedRecord.java Adds record-codec test sample with nested generics.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithNestedParameterized.java Adds record-codec test sample nested parameterized type.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithMapOfRecords.java Adds record-codec test sample map of records.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithMapOfListOfRecords.java Adds record-codec test sample map of lists of records.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithListOfRecords.java Adds record-codec test sample list of records.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithListOfListOfRecords.java Adds record-codec test sample list of list of records.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithIllegalBsonRepresentationOnAccessor.java Adds record-codec negative sample for invalid annotation usage.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithIllegalBsonPropertyOnCanonicalConstructor.java Adds record-codec negative sample for invalid annotation usage.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithIllegalBsonPropertyOnAccessor.java Adds record-codec negative sample for invalid annotation usage.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithIllegalBsonIgnoreOnComponent.java Adds record-codec negative sample for invalid annotation usage.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithIllegalBsonIgnoreOnAccessor.java Adds record-codec negative sample for invalid annotation usage.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithIllegalBsonIdOnCanonicalConstructor.java Adds record-codec negative sample for invalid annotation usage.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithIllegalBsonIdOnAccessor.java Adds record-codec negative sample for invalid annotation usage.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithIllegalBsonExtraElementsOnComponent.java Adds record-codec negative sample for invalid annotation usage.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithIllegalBsonExtraElementsOnAccessor.java Adds record-codec negative sample for invalid annotation usage.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithIllegalBsonDiscriminatorOnRecord.java Adds record-codec negative sample for invalid annotation usage.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithIllegalBsonCreatorOnMethod.java Adds record-codec negative sample for invalid annotation usage.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordWithIllegalBsonCreatorOnConstructor.java Adds record-codec negative sample for invalid annotation usage.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordParameterized.java Adds record-codec parameterized record sample.
bson-record-codec/src/test/unit/org/bson/codecs/record/samples/TestRecordEmbedded.java Adds record-codec embedded record sample.
bson-record-codec/src/test/unit/org/bson/codecs/record/RecordCodecProviderTest.java Adds tests for record codec provider behavior and default registry integration.
bson-record-codec/src/main/org/bson/codecs/record/package-info.java Adds package docs for record codec.
bson-record-codec/src/main/org/bson/codecs/record/RecordCodecProvider.java Adds record codec provider implementation.
bson-record-codec/build.gradle.kts Adds build configuration for record codec module.
bson-kotlinx/src/test/kotlin/org/bson/codecs/kotlinx/KotlinSerializerCodecProviderTest.kt Adds tests for Kotlinx codec provider behavior and default registry integration.
bson-kotlinx/src/main/kotlin/org/bson/codecs/kotlinx/utils/SerializationModuleUtils.kt Adds Kotlin utility for optional class availability checks.
bson-kotlinx/src/main/kotlin/org/bson/codecs/kotlinx/utils/BsonCodecUtils.kt Adds Kotlin utility factory methods and naming strategy handling.
bson-kotlinx/src/main/kotlin/org/bson/codecs/kotlinx/KotlinSerializerCodecProvider.kt Adds Kotlinx codec provider implementation.
bson-kotlinx/src/main/kotlin/org/bson/codecs/kotlinx/KotlinSerializerCodec.kt Adds Kotlinx codec implementation with annotation validation.
bson-kotlinx/src/main/kotlin/org/bson/codecs/kotlinx/JsonBsonEncoder.kt Adds JSON-backed encoder implementation.
bson-kotlinx/src/main/kotlin/org/bson/codecs/kotlinx/JsonBsonDecoder.kt Adds JSON-backed decoder implementation.
bson-kotlinx/src/main/kotlin/org/bson/codecs/kotlinx/BsonSerializers.kt Adds default Kotlinx serializers module for ObjectId and BsonValue.
bson-kotlinx/src/main/kotlin/org/bson/codecs/kotlinx/BsonConfiguration.kt Adds Kotlin BSON serialization configuration and naming strategy.
bson-kotlinx/build.gradle.kts Adds build configuration for Kotlinx BSON module.
bson-kotlin/src/test/kotlin/org/bson/codecs/kotlin/DataClassCodecProviderTest.kt Adds tests for Kotlin reflection-based data class codec provider.
bson-kotlin/src/main/kotlin/org/bson/codecs/kotlin/DataClassCodecProvider.kt Adds Kotlin reflection-based data class codec provider.
bson-kotlin/src/main/kotlin/org/bson/codecs/kotlin/ArrayCodecProvider.kt Adds array codec provider.
bson-kotlin/src/main/kotlin/org/bson/codecs/kotlin/ArrayCodec.kt Adds array codec implementation.
bson-kotlin/build.gradle.kts Adds build configuration for Kotlin BSON module.
bom/build.gradle.kts Updates BOM to include new modules and Scala multi-version handling.
LICENSE.txt Removes trailing blank lines.
History.md Removes legacy history file.
CONTRIBUTING.md Adds contributing guidelines markdown.
.travis.yml Removes legacy Travis configuration.
.gitmodules Adds specifications submodule declaration.
.github/workflows/release.yml Adds GitHub Actions release workflow.
.github/workflows/bump-version.sh Adds helper to bump Gradle version and commit.
.github/workflows/bump-and-tag.sh Adds helper to bump, tag, and bump to next snapshot.
.github/dependabot.yml Adds Dependabot config for submodule updates.
.github/CODEOWNERS Adds CODEOWNERS definition.
.git-blame-ignore-revs Adds ignore-revs file for blame hygiene.
.evergreen/template_ssdlc_compliance_report.md Adds SSDLC compliance report template.
.evergreen/static-checks.sh Adds Evergreen static checks script.
.evergreen/ssdlc-report.sh Adds Evergreen SSDLC report generator.
.evergreen/setup-env.bash Adds Evergreen Java/env setup and secret mapping.
.evergreen/run-x509-auth-tests.sh Adds Evergreen X509 auth test runner.
.evergreen/run-tests.sh Adds Evergreen main test runner orchestration.
.evergreen/run-socks5-tests.sh Adds Evergreen SOCKS5 test runner.
.evergreen/run-socket-tests.sh Adds Evergreen UNIX domain socket test runner.
.evergreen/run-scala-tests.sh Adds Evergreen Scala test runner.
.evergreen/run-reactive-streams-tck-tests.sh Adds Evergreen Reactive Streams TCK runner.
.evergreen/run-plain-auth-test.sh Adds Evergreen PLAIN auth runner.
.evergreen/run-perf-tests.sh Adds Evergreen perf test runner.
.evergreen/run-ocsp-test.sh Adds Evergreen OCSP runner.
.evergreen/run-mongodb-oidc-test.sh Adds Evergreen OIDC test runner.
.evergreen/run-mongodb-aws-test.sh Adds Evergreen AWS auth test runner.
.evergreen/run-mongodb-aws-ecs-test.sh Adds Evergreen AWS ECS auth runner.
.evergreen/run-load-balancer-tests.sh Adds Evergreen load balancer test runner.
.evergreen/run-kotlin-tests.sh Adds Evergreen Kotlin runners for unit/integration tests.
.evergreen/run-kms-tls-tests.sh Adds Evergreen KMS TLS runner.
.evergreen/run-gssapi-auth-test.sh Adds Evergreen GSSAPI auth runner.
.evergreen/run-graalvm-native-image-app.sh Adds Evergreen GraalVM native image runner.
.evergreen/run-fle-on-demand-credential-test.sh Adds Evergreen FLE on-demand credential test runner.
.evergreen/run-deployed-lambda-aws-tests.sh Adds Evergreen deployed AWS Lambda test runner.
.evergreen/run-csfle-tests-with-mongocryptd.sh Adds Evergreen CSFLE tests using mongocryptd runner.
.evergreen/run-csfle-aws-from-environment.sh Adds Evergreen CSFLE AWS environment credentials runner.
.evergreen/run-atlas-search-tests.sh Adds Evergreen Atlas search test runner.
.evergreen/run-atlas-search-index-management-tests.sh Adds Evergreen Atlas search index management test runner.
.evergreen/run-atlas-connectivity-tests.sh Adds Evergreen Atlas connectivity test runner.
.evergreen/publish.sh Adds Evergreen publishing script.
.evergreen/prepare-oidc-server-docker.sh Adds Evergreen OIDC server Docker preparation script.
.evergreen/prepare-oidc-get-tokens-docker.sh Adds Evergreen OIDC token generation script.
.evergreen/gradle-cache.sh Adds Evergreen Gradle cache priming script.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +3
[submodule "specifications"]
path = driver-core/src/test/resources/specifications
url = https://github.com/mongodb/specifications
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description/title mention only a BSON codec test change (adding Pattern coverage), but this PR adds a new Git submodule and a large set of new modules/tests/build and CI scripts (Scala/Kotlin/record codec, release automation, Evergreen scripts, removal of History/Travis). This should be split into focused PRs or the PR description updated to accurately reflect the scope and rationale, since reviewers/consumers will treat this as a major change-set.

Copilot uses AI. Check for mistakes.
Comment on lines +15 to +22
echo "Bump version in gradle.properties to ${RELEASE_VERSION}"
${SCRIPT_DIR}/bump-version.sh "${RELEASE_VERSION_WITHOUT_SUFFIX}-SNAPSHOT" "${RELEASE_VERSION}"

echo "Create release tag for ${RELEASE_VERSION}"
git tag -a -m "${RELEASE_VERSION}" r${RELEASE_VERSION}

echo "Bump to snapshot version for ${NEXT_VERSION}"
${SCRIPT_DIR}/bump-version.sh "${RELEASE_VERSION}" "${NEXT_VERSION}-SNAPSHOT"
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RELEASE_VERSION_WITHOUT_SUFFIX is referenced but never set in this script. This will cause the first bump to search/replace version=-SNAPSHOT and fail to update gradle.properties. Derive the value in this script (e.g., strip any suffix from RELEASE_VERSION), or pass it in explicitly as an argument and validate it.

Copilot uses AI. Check for mistakes.

steps:
- name: "Create release output"
run: echo '🎬 Release process for version ${{ env.RELEASE_VERSION }} started by @${{ github.triggering_actor }}' >> $GITHUB_STEP_SUMMARY
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step uses env.RELEASE_VERSION before it is populated (it is set later in the workflow under 'Store version numbers in env variables'). As written, the summary entry will have an empty version. Consider either moving this step after the env-var initialization, or use ${{ inputs.version }} here.

Suggested change
run: echo '🎬 Release process for version ${{ env.RELEASE_VERSION }} started by @${{ github.triggering_actor }}' >> $GITHUB_STEP_SUMMARY
run: echo '🎬 Release process for version ${{ inputs.version }} started by @${{ github.triggering_actor }}' >> $GITHUB_STEP_SUMMARY

Copilot uses AI. Check for mistakes.
Comment on lines +53 to +65
when (currentBsonType) {
BsonType.DOCUMENT -> readJsonObject()
BsonType.ARRAY -> readJsonArray()
BsonType.NULL -> JsonPrimitive(decodeNull())
BsonType.STRING -> JsonPrimitive(decodeString())
BsonType.BOOLEAN -> JsonPrimitive(decodeBoolean())
BsonType.INT32 -> JsonPrimitive(decodeInt())
BsonType.INT64 -> JsonPrimitive(decodeLong())
BsonType.DOUBLE -> JsonPrimitive(decodeDouble())
BsonType.DECIMAL128 -> JsonPrimitive(reader.readDecimal128())
BsonType.OBJECT_ID -> JsonPrimitive(decodeObjectId().toHexString())
BsonType.DATE_TIME -> JsonPrimitive(reader.readDateTime())
BsonType.TIMESTAMP -> JsonPrimitive(reader.readTimestamp().value)
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two issues here: (1) BSON null should decode to JsonNull (not JsonPrimitive(decodeNull())), otherwise null values may be represented incorrectly. (2) reader.readDecimal128() returns a Decimal128 object, which is not a Number in Kotlinx JSON APIs; wrapping it in JsonPrimitive(...) is likely incorrect (and may not compile depending on the available overloads). Consider converting Decimal128 to BigDecimal or string consistently and returning JsonNull for nulls.

Copilot uses AI. Check for mistakes.
Comment on lines +70 to +83
override fun decode(reader: BsonReader, decoderContext: DecoderContext): R {
reader.readStartArray()
val data = ArrayList<V?>()
while (reader.readBsonType() != BsonType.END_OF_DOCUMENT) {
if (reader.currentBsonType == BsonType.NULL) {
reader.readNull()
data.add(null)
} else {
data.add(decoderContext.decodeWithChildContext(codec, reader))
}
}
reader.readEndArray()
return unboxed(data)
}
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decoding allows null elements, but for primitive arrays (IntArray, BooleanArray, etc.) the later cast to ArrayList<Int> / ArrayList<Boolean> will fail at runtime if any null is present. For primitive arrays, nulls cannot be represented; the codec should reject BSON arrays containing nulls (e.g., throw a CodecConfigurationException/BsonInvalidOperationException) or define a deterministic mapping (less desirable).

Copilot uses AI. Check for mistakes.
transform("abc") should equal(BsonString("abc"))
}

it should "thrown a runtime exception when no transformer available" in {
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two typos in test descriptions: BigDecmial should be BigDecimal, and thrown should be throw (or rephrase to 'throw a compile-time error' if that's what is intended). Clear test names help when reading CI failures.

Copilot uses AI. Check for mistakes.
contextual(BsonBoolean::class, BsonValueSerializer as KSerializer<BsonBoolean>)
contextual(BsonDateTime::class, BsonValueSerializer as KSerializer<BsonDateTime>)
contextual(BsonDbPointer::class, BsonValueSerializer as KSerializer<BsonDbPointer>)
contextual(BsonDocument::class, BsonValueSerializer as KSerializer<BsonDocument>)
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BsonDocument::class is registered twice in the same SerializersModule. This duplication is redundant and can confuse future maintenance (e.g., if one entry is edited and the other forgotten). Remove the duplicate registration.

Copilot uses AI. Check for mistakes.
contextual(BsonSymbol::class, BsonValueSerializer as KSerializer<BsonSymbol>)
contextual(BsonTimestamp::class, BsonValueSerializer as KSerializer<BsonTimestamp>)
contextual(BsonUndefined::class, BsonValueSerializer as KSerializer<BsonUndefined>)
contextual(BsonDocument::class, BsonValueSerializer as KSerializer<BsonDocument>)
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BsonDocument::class is registered twice in the same SerializersModule. This duplication is redundant and can confuse future maintenance (e.g., if one entry is edited and the other forgotten). Remove the duplicate registration.

Suggested change
contextual(BsonDocument::class, BsonValueSerializer as KSerializer<BsonDocument>)

Copilot uses AI. Check for mistakes.
}
}

private val cachedElementNamesByDescriptor: MutableMap<String, Map<String, String>> = mutableMapOf()
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cachedElementNamesByDescriptor is a mutable global map accessed without synchronization. Codecs are typically used concurrently; this can lead to races or ConcurrentModificationException depending on usage. Prefer a thread-safe structure (e.g., ConcurrentHashMap) and populate via atomic operations (e.g., computeIfAbsent) or make the cache immutable per codec instance.

Copilot uses AI. Check for mistakes.
Comment on lines +149 to +153
cachedElementNamesByDescriptor[descriptor.serialName] = convertedNameMap
}

internal fun getCachedElementNamesByDescriptor(descriptor: SerialDescriptor): Map<String, String> {
return cachedElementNamesByDescriptor[descriptor.serialName] ?: emptyMap()
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cachedElementNamesByDescriptor is a mutable global map accessed without synchronization. Codecs are typically used concurrently; this can lead to races or ConcurrentModificationException depending on usage. Prefer a thread-safe structure (e.g., ConcurrentHashMap) and populate via atomic operations (e.g., computeIfAbsent) or make the cache immutable per codec instance.

Suggested change
cachedElementNamesByDescriptor[descriptor.serialName] = convertedNameMap
}
internal fun getCachedElementNamesByDescriptor(descriptor: SerialDescriptor): Map<String, String> {
return cachedElementNamesByDescriptor[descriptor.serialName] ?: emptyMap()
synchronized(cachedElementNamesByDescriptor) {
cachedElementNamesByDescriptor[descriptor.serialName] = convertedNameMap
}
}
internal fun getCachedElementNamesByDescriptor(descriptor: SerialDescriptor): Map<String, String> {
synchronized(cachedElementNamesByDescriptor) {
return cachedElementNamesByDescriptor[descriptor.serialName] ?: emptyMap()
}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.